
exports.GAResourceUtils = Core.Class.singleton ({
	
	getResourceOfType: function(storeObject, resourceType) {
		if (storeObject == null) {
			return null;
		}
		if (typeof storeObject.resources != 'undefined') {
			return storeObject.resources[resourceType];
		}
		return null;
	},
	
	getPathForObject: function(storeObject) {
		var path = [];
		if (storeObject.objectType == "store") {
			path.push(storeObject.visible_id);
		}
		else if (storeObject.objectType == "cat") {
			path.push(storeObject.parent.visible_id);
			path.push(storeObject.visible_id);
		}
		else if (storeObject.objectType == "item") {
			path.push(storeObject.parent.parent.visible_id);
			path.push(storeObject.parent.visible_id);
			path.push(storeObject.visible_id);
		}
		return path.join("/");
	},
	
	getResourceSavePath: function(storeObject, resource) {
		if (resource != null) {
			var path = [];
			path.push(GAConfigurations.getResourcesBasePath());
			path.push("/");
			path.push(GAResourceUtils.getPathForObject(storeObject));
			path.push("/");
			if (resource.type == GAResourceType.kDetail) {
				path.push("default_zip/");
			} 
			return path.join("");
		}
		return null;
	}
	
});